package com.my.hotel.mapper;

import com.my.hotel.entity.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface OrderMapper {
    @Select("select * from tb_order")
    List<Order> getList();
    @Update("update tb_order set order_status=#{orderStatus} where id=#{id}")
    void changeStatus(Order order);
    @Update("update tb_order set order_status=0 where order_num=#{num}")
    void changeStatusByNum(String num);
    @Select("select * from tb_order where user_id=#{userId}")
    List<Order> getMyOrder(Integer userId);
    @Insert("INSERT  INTO tb_order VALUES (null,#{orderNum},#{orderStatus},#{orderYdTime},#{orderRzTime},#{orderDay}" +
            ",#{userId},#{username},#{kfId},#{orderPayMoney})")
    void add(Order order);
    @Select("select * from tb_order where order_num = #{tradeNo} ")
    Order getOneByTradeNo(String tradeNo);
}
